package thread.matrix.row;

import thread.matrix.individual.IndividualMultiplierTask;

import java.util.ArrayList;
import java.util.List;

public class RowMultiplierTask implements Runnable{
    private double[][] matrix1;
    private double[][] matrix2;
    private double[][] result;
    private int i;

    public RowMultiplierTask(double[][] matrix1, double[][] matrix2, double[][] result, int i) {
        this.matrix1 = matrix1;
        this.matrix2 = matrix2;
        this.result = result;
        this.i = i;
    }

    @Override
    public void run() {
        for(int j=0;j<matrix2[0].length;j++){//matrix2的列数
            //初始化结果矩阵
            result[i][j] = 0;
            for(int k=0;k<matrix1.length;k++){//
                //矩阵的乘法,result[i][j],第i行，第j列
                //计算结果矩阵的值
                result[i][j] += matrix1[i][k]*matrix2[k][j];
                System.out.println("result["+i+"]"+"["+j+"]"+result[i][j]);
            }
        }
    }
}
